<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<%@taglib prefix="priv" uri="/mytag/privilege"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>声响影片</title>
<script type="text/javascript" src="${path}/js/scripts/bootstart.js"></script>
</head>
<body style="width: 98%; height: 90%;">
	<div style="width: 100%;">
		<div id="searchForm" class="mini-toolbar"
			style="border-bottom: 0; padding: 0px;">
			<table width="100%" border="0">
				<tr>
					<td style="width: 100%;"><priv:priv-btn btnname="search">
								文物名称: <input class="mini-textbox" name="basicName"
								emptyText="请输入文物名称，支持模糊查询" style="width: 20%;" />
							<a class="mini-button" onclick="datagrid.Search()"
								iconCls="icon-search">查询</a>
							<a class="mini-button" iconCls="icon-undo"
								onclick="datagrid.Clear()">重置</a>
						</priv:priv-btn> <priv:priv-btn btnname="edit">
							<a class="mini-button" iconCls="icon-edit"
								onclick="datagrid.edit()">修改</a>&nbsp;
						</priv:priv-btn> <priv:priv-btn btnname="remove">
							<a class="mini-button" iconCls="icon-remove"
								onclick="datagrid.remove()">删除</a>&nbsp;
						</priv:priv-btn></td>
				</tr>
			</table>
		</div>
	</div>
	<div id="datagrid1" class="mini-datagrid"
		url="${path}/mgr/natural/showList" pageSize="10"
		style="width: 100%; height: 90%;" allowResize="false"
		idField="naturalId" multiSelect="true" dataField="list"
		totalField="totalRecord" sizeList="[10,20,30]" sortField="naturalId"
		sortOrder="desc">
		<div property="columns">
			<div type="checkcolumn"></div>
			<div field="basicName" headerAlign="center" width="80"
				allowSort="true">文物名称</div>
			<div field="climate" headerAlign="center" width="80"
				allowSort="true">气候</div>
			<div field="geology" headerAlign="center" width="80"
				allowSort="true">地质土壤</div>
			<div field="hydrology" headerAlign="center" width="80"
				allowSort="true">水文植被</div>
			<div field="animalsPlants" headerAlign="center" width="100"
				allowSort="true">动物分布</div>
			<div field="file" headerAlign="center" width="100"
				allowSort="true">备注</div>
		</div>
	</div>
	<span style="color: red;">${errorMsg}</span>
	<script type="text/javascript" src="${path}/js/scripts/datagrid.js"></script>
	<script type="text/javascript" src="${path}/js/scripts/utils.js"></script>
	<script type="text/javascript" src="${path}/js/message.js"></script>
	<script type="text/javascript">
		mini.parse();
		var doc = $(document);
		$(function() {
			$.grid.init({
				id : "datagrid1"
			});
			window.datagrid = {};
			datagrid.edit = function() {
				var rows = $.grid.datagrid.getSelecteds();
				if (rows.length > 1) {
					mini.alert("只能修改一条数据！");
					return;
				}
				$.grid
						.edit({
							url : "${path}/mgr/natural/naturalform?flag=edit&basicId="+ $.grid.datagrid.getSelected().basicId,
							title : "测绘图纸",
							formId : "naturalForm",
							fieldId : "naturalId",
							width : doc.width() * 1 + "px",
							height : doc.height() * 1.2 + "px",
							dataUrl : "${path}/mgr/natural/showThisUpdate"
						});
			};
			datagrid.remove = function() {
				$.grid.remove({
					url : "${path}/mgr/natural/deleteInfo",
					paramName : "key", //获取参数的参数名
					showMsg : true,//是否显示提示信息（删除成功与否返回信息）
					fldId : "naturalId" //获取选中列的主键值对应的列名 
				});
			};
			//清除查询条件
			datagrid.Clear = function() {
				var SerachForm = new mini.Form("searchForm");
				SerachForm.reset();
			};
			//查询
			datagrid.Search = function() {
				var SerachForm = new mini.Form("searchForm");
				var data = SerachForm.getData(true);
				//获取以Struts2对象封装格式的json对象 {"对象1.属性":"属性值","对象.属性2":"属性值"}
				var jsonObject = myutils.parseFormToJsonObject(data);
				$.grid.datagrid.load(jsonObject);
			};
		});
	</script>
</body>
</html>